# =====================================================
# Makefile for HEAT SPECTRAL LIBRARY - EXAMPLES
# Copyright (C) 2009, Altieri Michele, Stefanoni Andrea
# =====================================================

# Options for building and debugging
DEBUG = -g
OPTIMIZE = -O2 -ftree-vectorize
X86_64 = -m64
CORE2 = -mtune=core2
CPPFLAGS = -Wall $(OPTIMIZE) $(X86_64) $(CORE2)

# Include directories for SPECTRAL and UMFPACK
SPECTRALDIR = ../src/
SPARSEDIR = /opt/local/include/ufsparse
CXXFLAGS = -I$(SPARSEDIR) -I$(SPECTRALDIR)

# Library directories for SPECTRAL, UMFPACK, AMD and BLAS
SPECTRALLIBDIR = ../lib/
UMFPACKLIBDIR = /opt/local/lib
LDFLAGS = -L$(UMFPACKLIBDIR) -L$(SPECTRALLIBDIR) -lumfpack -lamd -lblas -lm -lspectral

# Building executables
all:
	make exact
	make advdiff
	make tube

tube:
	$(CXX) $(CPPFLAGS) tube.cpp $(CXXFLAGS) $(LDFLAGS) -o tube

advdiff:
	$(CXX) $(CPPFLAGS) advdiff.cpp $(CXXFLAGS) $(LDFLAGS) -o advdiff

exact:
	$(CXX) $(CPPFLAGS) exact.cpp $(CXXFLAGS) $(LDFLAGS) -o exact

clean:
	rm -f tube advdiff exact
	rm -rf *.dSYM
	rm -f *.sh
	rm -f *.pdf
	rm -f *.png
	rm -f *.dat
	rm -f *.avi
	rm -f tubeData/*.dat
	rm -f exactData/*.dat
	rm -f advData/*.dat
